package com.hmall.api.item.client;


import cn.hutool.core.bean.BeanUtil;
import com.hmall.api.item.dto.ItemDTO;
import com.hmall.api.item.dto.OrderDetailDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@FeignClient(value = "item-service", path = "/items")
public interface ItemClient {

    @GetMapping
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);
    @PutMapping("/stock/deduct")
    public void deductStock(@RequestBody Collection<OrderDetailDTO> items);

    @GetMapping("/pageList")
    List<ItemDTO> queryItemByPage(@RequestParam("pageNo") Integer pageNo,
                                  @RequestParam("pageSize") Integer pageSize);

    @ApiOperation("根据id查询商品")
    @GetMapping("{id}")
    public ItemDTO queryItemById(@PathVariable("id") Long id);
}
